import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import { useRoute,useRouter } from 'vue-router'

export const useCounterStore = defineStore('counter', () => {
  const route = useRoute();
  const router = useRouter();
  const count = ref(0)
  const doubleCount = computed(() => count.value * 2)
  function increment() {
    count.value++
  }
  const showOpacity=ref(true)
  const setShowOpacity=(val:boolean)=>{
    showOpacity.value=val
  }
  const scrollToTop=()=> {
    const scrollableContent = document.getElementById('scrollableContent');
    scrollableContent.scrollTo({ top: 0, behavior: "smooth" });
  }
  return { count, doubleCount, increment,setShowOpacity,showOpacity,route,router,scrollToTop}
})
